package com.hluobo.library.action;

import org.json.JSONObject;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class ParseJsonAction extends ActionSupport {
	
	private String json;
	
	@Override
	public String execute() throws Exception {
		System.out.println(json);
		if(json != null){
			JSONObject jsonObj = new JSONObject(json);
			JSONObject info = jsonObj.getJSONObject("root");
			String username = info.getString("username");
			String password = info.getString("password");
			System.out.println("u "+username+"- p "+password);
			
		}
		return Action.SUCCESS;
	}

	public String getRoot() {
		return json;
	}

	public void setRoot(String root) {
		this.json = root;
	}
	
	

}
